package com.jht.pj.sys.controller;

import com.jht.pj.common.pojo.JsonResult;
import com.jht.pj.sys.pojo.Singer;
import com.jht.pj.sys.service.SingerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/singer/")
public class SingerController {

    @Autowired
    private SingerService singerService;

    //http://localhost/singer/doInsertSinger
    @PostMapping("doInsertSinger")
    public JsonResult doInsertSinger(Singer entity){
        singerService.insertSinger(entity);
        return new JsonResult("save ok");
    }

    //http://localhost/singer/dofindSingerNameById
    @GetMapping("dofindSingerNameById")
    public JsonResult dofindSingerNameById(Integer id){
        return new JsonResult(singerService.findSingerNameById(id));
    }

    //http://localhost/singer/findSinger
    @GetMapping("findSinger")
    public JsonResult findSinger(){
        return new JsonResult(singerService.findSinger());
    }
}
